﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

namespace Bowling
{
    public partial class BowlingScoreRecord : System.Web.UI.Page
    {
        private static String UserID;

        protected void Page_Load(object sender, EventArgs e)
        {
            UserID = Request["userID"];

            using (BowlingBiz_Tx bowlingBiz_Tx = new BowlingBiz_Tx())
            {
                if (UserID.Equals("NO ID"))
                {
                    BowlingHyukwon_RecordT[] bhr = bowlingBiz_Tx.ShowBowlingGameScoreRecord();
                    repBowlingScoreRecord.DataSource = bhr;
                    repBowlingScoreRecord.DataBind();
                }
                else
                {
                    BowlingHyukwon_RecordT[] bhr = bowlingBiz_Tx.ShowBowlingGameScoreRecord(UserID);
                    repBowlingScoreRecord.DataSource = bhr;
                    repBowlingScoreRecord.DataBind();
                }
                
            }
        }

        public void btnRemoveScoreRecord_Click(object sender, EventArgs e)
        {
            int seq = Int32.Parse(tbDeleteSeq.Text);
            using (BowlingBiz_Tx bowlingBiz_Tx = new BowlingBiz_Tx())
            {
                bowlingBiz_Tx.RemoveBowlingGameScore(seq);
            }

            tbDeleteSeq.Text = "";

        }

        public void btnSearchAll_Click(object sender, EventArgs e)
        {
            using (BowlingBiz_Tx bowlingBiz_Tx = new BowlingBiz_Tx())
            {
                BowlingHyukwon_RecordT[] bhr = bowlingBiz_Tx.ShowBowlingGameScoreRecord();
                repBowlingScoreRecord.DataSource = bhr;
                repBowlingScoreRecord.DataBind();
            }

        }

        protected void repBowlingScoreRecord_ItemCommand(object source, RepeaterCommandEventArgs e)
        {

        }

    }
}